package com.gym.controller;

import com.github.pagehelper.Page;
import com.gym.service.EquipmentService;
import com.gym.vo.EquipmentVo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RequestMapping("/equipment-provider")
@RestController
public class EquipmentController {

    @Resource
    private EquipmentService equipmentService;

    @GetMapping("/sel_equipment")
    public List<EquipmentVo> sel_equipment(@RequestParam int pageIndex){
        System.err.println("equipment-provider:sel_equipment..."+pageIndex);
        Page<EquipmentVo> page = equipmentService.selectAllEquipment(pageIndex,5);
        System.err.println(page);
        return page.getResult();
    }

}
